<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>阿福易购-修改密码</title>
    <link rel="stylesheet" href="/css/app.css">
</head>
<body ontouchstart="">
<header class="ui-header ui-header-stable  af-header">
    <ul class="ui-row-flex">
        <li class="ui-col ui-flex ui-flex-pack-start">
            <a ontouchstart="window.history.back();"><i class="ui-icon-return"></i></a>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-center">
            <h1>修改密码</h1>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-end">
        </li>
    </ul>
</header>
<div class="ui-container">
    <section class="ui-form-login">
        <form id="form" action="#" novalidate>



            <div class="ui-form-item ui-form-item-pure ui-border">
                <input type="password" name="pwd" data-reg="^[\S]{6,20}$" placeholder="请输入旧密码" required>
                <a href="#" class="ui-icon-close"></a>
            </div>
            <div class="ui-form-item ui-form-item-pure ui-form-item-switch ui-border">
                <input id="newPwd" type="password" name="pwd" data-reg="^[\S]{6,20}$" placeholder="请设置6-20位新密码" required>
                <a href="#" class="ui-icon-close"></a>
                <label class="ui-switch ui-switch-primary">
                    <input type="checkbox">
                </label>
            </div>
            <div class="ui-form-item ui-form-item-pure ui-form-item-switch ui-border">
                <input id="rePwd" type="password" name="pwd" data-reg="^[\S]{6,20}$" placeholder="请再次输入新密码" required>
                <a href="#" class="ui-icon-close"></a>
                <label class="ui-switch ui-switch-primary">
                    <input type="checkbox">
                </label>
            </div>
            <button class="ui-btn-lg ui-btn-primary" type="submit">确认修改</button>
        </form>

    </section>
</div>

<script src="/lib/zepto.min.js"></script>
<script src="/js/frozen.js"></script>
<script src="/js/app.min.js"></script>
<script>
    $(function () {
        var form=$('#form');
        var switchItem=form.find('.ui-switch');
        var newPwd=form.find('#newPwd');
        var rePwd=form.find('#rePwd');

        //显示密码
        switchItem[0]&&TogglePwd(switchItem);

        form.on('submit',function () {
            var isOK= RegForm(form);
            var equalTo=rePwd.val()===newPwd.val();
            if(!isOK) return false;
            if(isOK&&!equalTo) {
                topTip('两次输入的密码不一致！',{type:'warn'});
                return false;
            }
        });
    })
</script>
</body>
</html>